<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>iBOS/e WebShell - eForms</title>
	<CFOUTPUT>
		<LINK REL="StyleSheet" HREF="#client.wstheme_path##client.empcolor#.css" TYPE="text/css">
	</CFOUTPUT>
	<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
	<!--		
		function printMe(whichArea) {
			if (document.getElementById)
			{
				document.getElementById(whichArea).style.visibility = 'hidden';
		
			}
			window.print();
		}
		function PrePrinted(sURL,sformat) {
			window.open("../pre_printformat/" + sformat + "?" + sURL,
						"PrePrinted", "width=700,height=530,ScrollBars=Yes,Resizable=Yes");
		}
	// -->
	</SCRIPT>
</head>

<body>
<CFSET sTypeID=Decrypt(url.id, client.ek)>

<!--- check if user has access to the form --->
<CFSET sRightID = "">
<CFINCLUDE TEMPLATE="../common/_validate.cfm">
<CFIF sRightID EQ "">
	<CFLOCATION URL="../common/norights.cfm" ADDTOKEN="No">
</CFIF>

<!--- get for form details --->
<CFQUERY NAME="GetForm" DATASOURCE="#client.company_dsn#">
	SELECT DISTINCT
		E.FORMCODE, E.FORMGROUP, E.FORMTYPE, E.PROCESSCODE,
		E.DESCRIPTION, E.TABLENAME_FK,
		E.PK_FIELD1, E.PK_FIELD2, E.PK_FIELD3,
		E.PK_FIELD4, E.PK_FIELD5, E.ENABLEATTACHMENTS,E.PREPRINTFORMAT,E.ATTACHEDMAIL,E.ATTACHEDLINK,
		E1.ISADD, E1.ISEDIT, E1.ISDELETE, E1.ISVIEW, E1.ISEMAIL, E1.ISPRINT
	FROM ECRGFORMS E, ECRTFORMS E1
	WHERE
		(E1.USERGRPID_FK IN (#preserveSingleQuotes(sRightID)#)) AND
		(E1.FORMCODE_FK  = E.FORMCODE) AND
		(E1.FORMCODE_FK  = '#sTypeID#')
</CFQUERY>
<CFQUERY NAME="GetFormDtl" DATASOURCE="#client.company_dsn#">
	SELECT DISTINCT	
		E2.ATTACHEDLINK, E2.DEFAULTASCDESC, E2.DEFAULTORDER, E2.DESCRIPTION, E2.DETAILTABLE, E2.DTL_FIELD1, E2.DTL_FIELD2,
		E2.DTL_FIELD3, E2.DTL_FIELD4, E2.DTL_FIELD5, E2.ENABLEATTACHMENTS, E2.FORMCODE, E2.FORMDETAILCODE, E2.ISDEFAULT,
		E2.ISONERECORD, E2.LNK_FIELD1, E2.LNK_FIELD2, E2.LNK_FIELD3, E2.LNK_FIELD4, E2.LNK_FIELD5, E2.SORTID
	FROM ECRGFORMS E, ECRTFORMS E1, ECRGFORMSDETAIL E2
	WHERE
		(E1.USERGRPID_FK IN (#preserveSingleQuotes(sRightID)#)) AND
		(E1.FORMCODE_FK  = E2.FORMCODE) AND (E.FORMCODE = E2.FORMCODE) AND
		(E1.FORMCODE_FK  = '#sTypeID#')
		ORDER BY E2.SORTID ASC, E2.DESCRIPTION ASC
</CFQUERY>
<CFIF NOT(GetForm.RecordCount)>
	<CFMODULE TEMPLATE="#client.common_path#cfm_error.cfm" MODULE="#session.tabid#" TYPE="ERR_TEMPLATE">
</CFIF>

<CFSET accessAdd = 'N'>
<CFSET accessEdit = 'N'>
<CFSET accessDelete = 'N'>
<CFSET accessView = 'N'>
<CFSET accessEmail = 'N'>
<CFSET accessPrint = 'N'>

<CFLOOP QUERY="GetForm">
	<CFIF GetForm.ISADD EQ 'Y'>
		<CFSET accessAdd = 'Y'>
	</CFIF>
	<CFIF GetForm.ISEDIT EQ 'Y'>
		<CFSET accessEdit = 'Y'>
	</CFIF>
	<CFIF GetForm.ISDELETE EQ 'Y'>
		<CFSET accessDelete = 'Y'>
	</CFIF>
	<CFIF GetForm.ISVIEW EQ 'Y'>
		<CFSET accessView = 'Y'>
	</CFIF>
	<CFIF GetForm.ISEMAIL EQ 'Y'>
		<CFSET accessEmail = 'Y'>
	</CFIF>
	<CFIF GetForm.ISPRINT EQ 'Y'>
		<CFSET accessPrint = 'Y'>
	</CFIF>
</CFLOOP>

<CFQUERY NAME="GetLevelID" DATASOURCE="#client.global_dsn#">
	SELECT LEVELID
	FROM GRGBOSETABLE
	WHERE
		(TABLENAME = '#GetForm.TABLENAME_FK#')
</CFQUERY>
<CFIF NOT(GetLevelID.RecordCount)>
	<CFMODULE TEMPLATE="#client.common_path#cfm_error.cfm" MODULE="#session.tabid#" TYPE="ERR_DATA">
</CFIF>

<!--- get table location --->
<CFMODULE TEMPLATE="#client.common_path#cfm_leveldsn.cfm" DBLEVEL="#GetLevelID.LEVELID#">
<CFSET table_dsn = DSN>

<!--- get the fields for the form --->
<CFQUERY NAME="GetFields" DATASOURCE=#client.global_dsn#>
	SELECT *
	FROM GRGBOSETABLEFIELDS
	WHERE
		(TABLENAME  = '#GetForm.TABLENAME_FK#') AND
		(ISVISIBLEEFORM    = 'Y' OR ISVISIBLEEFORM IS NULL) AND
		(COLUMNNAME <> 'PERSONNELIDNO') AND
		(COLUMNNAME <> 'RECDATECREATED') AND
		(COLUMNNAME <> 'RECCREATEDBY') AND
		(COLUMNNAME <> 'USERID') AND
		(COLUMNNAME <> 'DATELASTUPDATE') AND
		(COLUMNNAME <> 'TIMELASTUPDATE') AND
		(COLUMNNAME <> 'ROUTEID') AND
		(#sqlSTRLEN#(COLUMNDESC) > 0)
	ORDER BY FIELDGROUP, COLUMNORDER, COLUMNDESC, COLUMNNAME
</CFQUERY>

<!--- get records for the eform to print --->
<CFQUERY NAME="GetEntry" DATASOURCE="#table_dsn#" MAXROWS=1>
	SELECT *
	FROM #GetForm.TABLENAME_FK#
	WHERE
		(PERSONNELIDNO = '#client.chapa#')
		<CFLOOP  INDEX="x" FROM="1" TO="5">
			<CFIF evaluate("GetForm.PK_FIELD" & x) NEQ "">
				<CFSET theVal = evaluate("url." & evaluate("GetForm.PK_FIELD" & x))>
				AND (#ucase(evaluate("GetForm.PK_FIELD" & x))# = '#theVal#')
			</CFIF>
		</CFLOOP>
</CFQUERY>

<CFIF NOT(GetEntry.RecordCount)>
	<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="#appname#">
	<BR><BR><B>Unauthorized access detected!</B><BR><BR>
	Please use the standard editor to avoid
	being reported for illegal use of the software.
	<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
	<CFABORT>
</CFIF>

<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
	<CFOUTPUT>
	
	<CFSET sUFValue="id=#sTypeID#">
	
	<CFLOOP  INDEX="x" FROM="1" TO="5">
		<CFIF evaluate("GetForm.PK_FIELD" & x) NEQ "">
			<CFSET sUFValue = sUFValue & "&" & lcase(evaluate("GetForm.PK_FIELD" & x)) & "=" & evaluate("GetEntry." & evaluate("GetForm.PK_FIELD" & x))>
		</CFIF>
	</CFLOOP>
	
	<TR>
		<TD ALIGN="left">
			<IMG SRC="#client.image_path##session.site_ibose#">
		</TD>
		<TD NOWRAP CLASS="bold14">
			<FONT FACE="Impact" SIZE="+2">#client.companyname#</FONT><BR>
			#GetForm.DESCRIPTION#
		</TD>
	</TR>
		<TR ID="printarea" style="visibility: visible">
			<FORM METHOD="post" NAME="printform">
				<TD></TD>
				<TD ALIGN="RIGHT">
					Show Approval:&nbsp;
					<SELECT NAME="cmbApprove" SIZE="1" CLASS="bitbtn">
						<OPTION SELECTED VALUE="all">&nbsp;All</OPTION>
						<OPTION VALUE="LastRoute">&nbsp;Last Routing Process</OPTION>
						<OPTION VALUE="None">&nbsp;None</OPTION>
					</SELECT>
					<INPUT TYPE="submit" NAME="btnProceed" CLASS="bitbtn" VALUE="Proceed">&nbsp;
					<IMG SRC="#client.icon_path#print.gif" BORDER=0>&nbsp;<A NAME="goTop" HREF="###CreateUUID()#" onClick="javascript: printMe('printarea');" CLASS="regular11">print</A>
					<CFIF GetForm.PREPRINTFORMAT NEQ "">
						<IMG SRC="#client.icon_path#print.gif" BORDER=0>&nbsp;<A NAME="goTop" href="###CreateUUID()#" ONCLICK="PrePrinted('#sUFValue#','#GetForm.PREPRINTFORMAT#')" CLASS="regular11">Pre-Printed Format</A>
					</CFIF>
				</TD>
			</FORM>
		</TR>
	</div>
	</CFOUTPUT>
</TABLE>
<!--- Add by Badz 05292009 --->
<CFQUERY NAME="GetEntryAID" DATASOURCE="#table_dsn#">
	SELECT ACTIVITYID FROM CRGROUTEDETAILS
	WHERE ROUTEID = '#getentry.routeid#' AND ACTIVITYID <> 'INITIALIZATION'
	ORDER BY ORDERID ASC
</CFQUERY>
<CFQUERY NAME="GetEntryPCode" DATASOURCE="#table_dsn#">
	SELECT PROCESSCODE FROM CINFFACTIVITY
	WHERE ACTIVITYID = '#GetEntryAID.activityid#'
	ORDER BY ORDERID ASC
</CFQUERY>
<!--- End Add by Badz 05292009 --->
<!--- get attachments --->
<CFINCLUDE TEMPLATE="..\common\_getattachments.cfm">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1 WIDTH="100%">
	<TR><TD WIDTH="50%">
		<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 WIDTH="100%">
		<!--- Modified by Maan 06272007 === show all approver actions/comments regardless of form's status --->
		<!---<CFIF GetEntry.APPROVED EQ "Y">--->
			<!---CFQUERY NAME="getOrderID" DATASOURCE="#client.company_dsn#">
				SELECT ORDERID FROM CINFFACTIVITY WHERE PROCESSCODE = '#GetEntryPCode.PROCESSCODE#' ORDER BY ORDERID ASC
			</CFQUERY--->
			<CFQUERY NAME="getOrderID" DATASOURCE="#client.company_dsn#">
				SELECT ORDERID FROM CINFFACTIVITY WHERE PROCESSCODE = '#GetEntryPCode.PROCESSCODE#' ORDER BY ORDERID ASC
			</CFQUERY><!--- Modified by Badz 05292009 --->
			<CFLOOP QUERY="getOrderID">
				<!---CFQUERY NAME="getActivityDtl" DATASOURCE="#client.company_dsn#">
					SELECT ROLECODE, MAPPING, ACTIVITYID FROM CINFFACTIVITY WHERE PROCESSCODE = '#GetForm.PROCESSCODE#' AND ORDERID = '#getOrderID.ORDERID#'
				</CFQUERY--->
				<CFQUERY NAME="getActivityDtl" DATASOURCE="#client.company_dsn#">
					SELECT ROLECODE, MAPPING, ACTIVITYID FROM CINFFACTIVITY WHERE PROCESSCODE = '#GetEntryPCode.PROCESSCODE#' AND ORDERID = '#getOrderID.ORDERID#'
				</CFQUERY><!--- Modified by Badz 05292009 --->
				<CFQUERY NAME="getRouteRec" DATASOURCE="#client.company_dsn#">
					SELECT ROUTER, ROUTERREMARKS, STATUS, RECDATECREATED FROM CRGROUTEDETAILS 
					WHERE ROUTEID = '#GetEntry.ROUTEID#' AND ACTIVITYID = '#getActivityDtl.ACTIVITYID#'
					ORDER BY RECDATECREATED DESC
				</CFQUERY>
				<CFSET theRoutedate="">
				<CFIF getRouteRec.RECORDCOUNT NEQ 0>
					<CFSET theRoutedate=DATEFORMAT("#getRouteRec.RECDATECREATED#", "DD MMM YYYY")>
					<CFIF ISDEFINED("FORM.BTNPROCEED")>
						<CFOUTPUT>
							<CFIF FORM.CMBAPPROVE EQ "ALL">
								<CFLOOP QUERY="getRouteRec">
									<TR>
										<TD COLSPAN=2 align="left">
											&nbsp;#getRouteRec.ROUTER# / <i>#theRoutedate#</i> - <b>#getRouteRec.STATUS#</b><br>
											&nbsp;&nbsp;&nbsp;<CFIF getRouteRec.ROUTERREMARKS NEQ "" AND getRouteRec.ROUTERREMARKS NEQ "|NULL|">#getRouteRec.ROUTERREMARKS#<CFELSE> <I> [no comment] </I> </CFIF>
											<CFSET theImage="#client.image_path#" & "Signatures/" & "#getRouteRec.ROUTER#" & ".jpg">
											<CFSET theImage2="#expandpath(client.image_path)#" & "Signatures/" & "#getRouteRec.ROUTER#" & ".jpg">
											<CFIF FileExists(theImage2)>
												<img align="right" src="#theImage#" alt="Signed: #getRouteRec.Router#">
											</CFIF>
										</TD>
									</TR>
								</CFLOOP>
							<CFELSEIF FORM.CMBAPPROVE EQ "LastRoute">
								<CFOUTPUT>
									<TR>
										<TD COLSPAN=2 align="left">
											&nbsp;#getRouteRec.ROUTER# / <i>#theRoutedate#</i> - <b>#getRouteRec.STATUS#</b><br>
											&nbsp;&nbsp;&nbsp;<CFIF getRouteRec.ROUTERREMARKS NEQ "" AND getRouteRec.ROUTERREMARKS NEQ "|NULL|">#getRouteRec.ROUTERREMARKS#<CFELSE> <I> [no comment] </I> </CFIF>
											<CFSET theImage="#client.image_path#" & "Signatures/" & "#getRouteRec.ROUTER#" & ".jpg">
											<CFIF FileExists(theImage)>
												<img align="right" src="#client.image_path##theImage#" alt="Signed: #getRouteRec.Router#">
											
											</CFIF>
										</TD>
									</TR>
								</CFOUTPUT>
							<CFELSEIF FORM.CMBAPPROVE EQ "NONE">
							</CFIF>
						</CFOUTPUT>
					<CFELSE>
						<CFOUTPUT>
							<CFLOOP QUERY="getRouteRec">
								<TR>
									<TD COLSPAN=2 align="left">
										&nbsp;#getRouteRec.ROUTER# / <i>#theRoutedate#</i> - <b>#getRouteRec.STATUS#</b><br>
										&nbsp;&nbsp;&nbsp;<CFIF getRouteRec.ROUTERREMARKS NEQ "" AND getRouteRec.ROUTERREMARKS NEQ "|NULL|">#getRouteRec.ROUTERREMARKS#<CFELSE> <I> [no comment] </I> </CFIF>
										<CFSET theImage="#client.image_path#" & "Signatures/" & "#getRouteRec.ROUTER#" & ".jpg">
										<CFIF FileExists(theImage)>
											<img align="right" src="#client.image_path##theImage#" alt="Signed: #getRouteRec.Router#">
									
										</CFIF>
									</TD>
								</TR>
							</CFLOOP>
						</CFOUTPUT>
					</CFIF>
				</CFIF>
			</CFLOOP>
		<!---</CFIF>--->
		</TABLE>
	</TD>
	<TD VALIGN="TOP">
			
	</TD></TR>
</TABLE>
<br>
<CFOUTPUT QUERY="GetFields" GROUP="FIELDGROUP">
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2 WIDTH="100%">
	<CFIF len(trim(FIELDGROUP)) NEQ 0>
	<TR>
		<TD CLASS="bold11" BGCOLOR="#client.color_tblset2#" COLSPAN=3>
			&nbsp;#FIELDGROUP# #HINT#
		</TD>
	</TR>
	</CFIF>

<CFOUTPUT>
	<!--- get the value of the entry --->
	<CFPARAM NAME="Form.edt#COLUMNNAME#" DEFAULT="">
	<CFSET sEntryValue = #evaluate("GetEntry." & COLUMNNAME)#>

	<!--- skip null values --->
	<CFIF len(trim(sEntryValue)) NEQ 0>

		<TR VALIGN="top">
			<TD NOWRAP VALIGN="top" ALIGN="right">#COLUMNDESC#</TD>
			<TD VALIGN="top" WIDTH="100%" HEIGHT=18 WRAP>&nbsp;<B>
			<!--- For extra desc in lookup --->
			<CFSET lWithExtra=false>

			<!--- check on what form control to use --->
			<CFSWITCH EXPRESSION="#lcase(COLUMNTYPE)#">

				<!--- calculator lookup --->
				<CFCASE VALUE="ftinteger">
					#sEntryValue#
				</CFCASE>

				<!--- calculator lookup --->
				<CFCASE VALUE="ftfloat">
					#sEntryValue#
				</CFCASE>

				<!--- calendar lookup --->
				<CFCASE VALUE="ftdatetime">
					<CFIF sEntryValue EQ "01/01/1900">
						&nbsp;
					<CFELSE>
						#DateFormat(sEntryValue,"mmmm d, yyyy")#
					</CFIF>
				</CFCASE>
				<!---
				<CFCASE VALUE="ftcurrency">
						<CFMODULE TEMPLATE="../common/formatCurrency.cfm" sValue="#sEntryValue#">
						#formatedValue#
				</CFCASE>--->
				<!--- memo fields --->
				<CFCASE VALUE="ftMemo">
					<!---<TEXTAREA ROWS="5" STYLE="background-color: transparent; border-bottom: none; border-left: none; border-right: none; border-top: none; font-weight: bold; width: 99%;">#HTMLEditFormat(sEntryValue)#</TEXTAREA>--->
					#HTMLEditFormat(sEntryValue)#
				</CFCASE>

				<!--- blob fields --->
				<CFCASE VALUE="ftblob">
					interface not supported.
				</CFCASE>

				<!--- images (asks for paths) --->
				<CFCASE VALUE="ftgraphic">
					interface not supported.
				</CFCASE>

				<CFDEFAULTCASE>
					<!--- there's a lookup --->
					<CFQUERY NAME="GetLookup" DATASOURCE="#client.global_dsn#">
						SELECT A.*, B.LEVELID
						FROM GSTLOOKUP A, GRGBOSETABLE B
						WHERE
							(A.MASTERTABLE = '#GetForm.TABLENAME_FK#') AND
							(A.MASTERFIELD = '#COLUMNNAME#') AND
							(A.LOOKUPTABLE = B.TABLENAME)
					</CFQUERY>
					<CFIF GetLookup.RecordCount>
						<CFIF (#trim(GetLookup.LEVELID)# IS "") OR
							(#trim(GetLookup.LOOKUPKEYFIELD)# IS "") OR
							(#trim(GetLookup.LOOKUPRESULTFIELD)# IS "") OR
							(#trim(GetLookup.LOOKUPTABLE)# IS "")>
							<I>*Lookup not properly setup.</I>
						<CFELSE>
							<!--- get the description in the lookup --->
							<CFIF len(trim(sEntryValue)) NEQ 0>
								<CFMODULE TEMPLATE="#client.common_path#cfm_leveldsn.cfm" DBLEVEL="#GetLookup.LEVELID#">
								<CFSET lk_dsn = DSN>

								<CFQUERY NAME="GetLkDesc" DATASOURCE="#lk_dsn#">
									SELECT #GetLookup.LOOKUPRESULTFIELD#
									<!--- For extra lookup description --->
									<CFIF Trim(GetLookup.EXTRARESULTFLD) NEQ "">
										,#GetLookup.EXTRARESULTFLD#
										<CFSET lWithExtra=true>
									</CFIF>
									FROM #GetLookup.LOOKUPTABLE#
									WHERE
										(#GetLookup.LOOKUPKEYFIELD# = '#sEntryValue#')
								</CFQUERY>

								<CFIF GetLkDesc.RecordCount>
									[#sEntryValue#] #evaluate("GetLkDesc." & GetLookup.LOOKUPRESULTFIELD)#
								<CFELSE>
									[value not found in the lookup.]
								</CFIF>

								<!--- for chart 
								<CFIF LCase(ISORGCHART) IS "y">
									&nbsp;&nbsp;<A HREF="javascript:ShowChart('#Trim(GetLookup.LEVELID)#','#Trim(GetLookup.LOOKUPTABLE)#','#Trim(GetLookup.LOOKUPKEYFIELD)#','#Trim(GetLookup.LOOKUPRESULTFIELD)#','#sEntryValue#', '', '#COLUMNDESC#')">show chart</A>
								</CFIF>--->
							</CFIF>
						</CFIF>	<!--- getlookup.recordcount --->
					<CFELSE>
						<!--- standard edit --->
						#HTMLEditFormat(sEntryValue)#
					</CFIF>

				</CFDEFAULTCASE>
			</CFSWITCH>
			</B>
			</TD>
		</TR>

		<CFIF lWithExtra>
			<!--- Get the description and datatype of display fields for lookup --->
			<CFSET sComma="">
			<CFQUERY NAME="qryDispLkUp" DATASOURCE=#client.global_dsn#>
				SELECT COLUMNNAME, COLUMNDESC, COLUMNTYPE
				FROM GRGBOSETABLEFIELDS
				WHERE (TABLENAME = '#Trim(GetLookup.LOOKUPTABLE)#') AND
					  (
						COLUMNNAME IN (
					<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="x">
						#sComma# '#Trim(x)#'
						<CFSET sComma=",">
					</CFLOOP>
					  )
					  )
			</CFQUERY>
			<CFSET lstKeyValue=Valuelist(qryDispLkUp.COLUMNNAME)>

			<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="x">
				<CFSET x = trim(x)>
				<TR VALIGN="top">

					<CFSET nPos=ListFindNocase(#lstKeyValue#, #x#)>
					<CFIF nPos NEQ 0>
						<CFSET sColDesc=#qryDispLkUp.COLUMNDESC[nPos]#>
						<CFSET sDataType=#qryDispLkUp.COLUMNTYPE[nPos]#>
					<CFELSE>
						<CFSET sColDesc="">
						<CFSET sDataType="">
					</CFIF>

					<TD NOWRAP VALIGN="top" ALIGN="right">#sColDesc#:</TD>
					<TD VALIGN="top" WIDTH="100%" HEIGHT=18 nowrap>&nbsp;<B>
						<!--- check on what form control to use --->
						<CFIF LCase(sDataType) IS "ftmemo">
							<TEXTAREA ROWS="3" STYLE="background-color: transparent; border-bottom: none; border-left: none; border-right: none; border-top: none; font-weight: bold; width: 99%;">#HTMLEditFormat(evaluate("GetLkDesc." & Trim(x)))#</TEXTAREA>
						<CFELSEIF LCase(sDataType) IS "ftdatetime">
							#DateFormat(evaluate("GetLkDesc." & Trim(x)), "mmmm d, yyyy")#
						<CFELSE>
							#HTMLEditFormat(evaluate("GetLkDesc." & Trim(x)))#
						</CFIF>
					</TD>
				</TR>
			</CFLOOP>
		</CFIF>
	</CFIF>
	</CFOUTPUT>
</CFOUTPUT>
<CFLOOP QUERY="GetFormDtl">
	<CFQUERY NAME="GetDtlFields" DATASOURCE=#client.global_dsn#>
		SELECT *
		FROM GRGBOSETABLEFIELDS
		WHERE
			(TABLENAME  = '#DETAILTABLE#') AND
			(ISVISIBLEEFORM    = 'Y' OR ISVISIBLEEFORM IS NULL) AND
			(COLUMNNAME <> 'PERSONNELIDNO') AND
			(COLUMNNAME <> 'RECDATECREATED') AND
			(COLUMNNAME <> 'RECCREATEDBY') AND
			(COLUMNNAME <> 'USERID') AND
			(COLUMNNAME <> 'DATELASTUPDATE') AND
			(COLUMNNAME <> 'TIMELASTUPDATE') AND
			(COLUMNNAME <> 'ROUTEID') AND
			(#sqlSTRLEN#(COLUMNDESC) > 0)
		ORDER BY FIELDGROUP, COLUMNORDER, COLUMNDESC, COLUMNNAME
	</CFQUERY>
	<CFSET myArr = ArrayNew(1)>
	<cfset ctr = 1>
	<CFLOOP QUERY="GetDtlFields">
		<CFSET myArr[ctr][1] = COLUMNNAME>
		<CFSET myArr[ctr][2] = COLUMNDESC>
		<CFSET myArr[ctr][3] = COLUMNTYPE>
		<cfset ctr = ctr + 1>
	</CFLOOP>
	<cfset ctr = ctr - 1>
	<!--- Removed MAXROWS=1 - Limits the infocard detail to one - Badz 05202009 
	<CFQUERY NAME="GetDtlEntry" DATASOURCE="#table_dsn#" MAXROWS=1> --->
	<CFQUERY NAME="GetDtlEntry" DATASOURCE="#table_dsn#">
		SELECT *
		FROM #GetFormDtl.DETAILTABLE#
		WHERE
			#GetFormDtl.DTL_FIELD1# = '#evaluate("GetEntry." & GetFormDtl.LNK_FIELD1)#'
			<CFLOOP INDEX="nFld" FROM="2" TO="5">
				<CFIF evaluate("GetFormDtl.DTL_FIELD" & nFld) NEQ "" AND evaluate("GetFormDtl.LNK_FIELD" & nFld) NEQ "">
					AND #evaluate("GetFormDtl.DTL_FIELD" & nFld)# = '#evaluate("GetEntry." & (evaluate("GetFormDtl.LNK_FIELD" & nFld)))#'
				</CFIF>
			</CFLOOP>
	</CFQUERY>
	<CFIF GetDtlEntry.RECORDCOUNT>
		<CFOUTPUT>
			<TR>
				<TD COLSPAN="100" ALIGN="CENTER" CLASS="bold" BGCOLOR="#client.color_appbody#">#DESCRIPTION#</TD>
			</TR>
		</CFOUTPUT>
		<CFOUTPUT QUERY="GetDtlEntry">
			<CFLOOP INDEX="myCol" FROM="1" TO="#ctr#">
				<CFSET sDtlEntryVal = evaluate(myArr[myCol][1])>
				<CFIF len(trim(sDtlEntryVal)) NEQ 0>
				<CFIF mycol EQ 1><!---To check if it's the first record so the top border will be thick - Badz 03242009--->
				<TR>
					<TD style="border-top-width:thick" ALIGN="RIGHT">#myArr[myCol][2]#</TD><TD style="border-top-width:thick" CLASS="bold">&nbsp;&nbsp;
				<CFELSE>
				<TR>
					<TD ALIGN="RIGHT">#myArr[myCol][2]#</TD><TD CLASS="bold">&nbsp;&nbsp;
				</CFIF><!---End Badz 03242009--->
					<!---<CFSET sDtlEntryVal = evaluate(myArr[myCol][1])>--->
					<CFSWITCH EXPRESSION="#lcase(myArr[myCol][3])#">
						<!--- calendar lookup --->
						<CFCASE VALUE="ftdatetime">
							<CFIF sDtlEntryVal EQ "01/01/1900">
								&nbsp;
							<CFELSE>
								#DateFormat(sDtlEntryVal,"mmm d, yyyy")#
							</CFIF>
						</CFCASE>
						<!---<CFCASE VALUE="ftcurrency">
								<CFMODULE TEMPLATE="../common/formatCurrency.cfm" sValue="#sDtlEntryVal#">
								#formatedValue#
						</CFCASE>--->
						<!--- memo fields --->
						<CFCASE VALUE="ftMemo">
							#HTMLEditFormat(sDtlEntryVal)#
						</CFCASE>
		
						<!--- blob fields --->
						<CFCASE VALUE="ftblob">
							interface not supported.
						</CFCASE>
		
						<!--- images (asks for paths) --->
						<CFCASE VALUE="ftgraphic">
							interface not supported.
						</CFCASE>
		
						<CFDEFAULTCASE>
							<!--- there's a lookup --->
							<CFQUERY NAME="GetLookup" DATASOURCE="#client.global_dsn#">
								SELECT A.*, B.LEVELID
								FROM GSTLOOKUP A, GRGBOSETABLE B
								WHERE
									(A.MASTERTABLE = '#GetFormDtl.DETAILTABLE#') AND
									(A.MASTERFIELD = '#myArr[myCol][1]#') AND
									(A.LOOKUPTABLE = B.TABLENAME)
							</CFQUERY>
							<CFIF GetLookup.RecordCount>
								<CFIF (#trim(GetLookup.LEVELID)# IS "") OR
									(#trim(GetLookup.LOOKUPKEYFIELD)# IS "") OR
									(#trim(GetLookup.LOOKUPRESULTFIELD)# IS "") OR
									(#trim(GetLookup.LOOKUPTABLE)# IS "")>
									<I>*Lookup not properly setup.</I>
								<CFELSE>
									<!--- get the description in the lookup --->
									<CFIF len(trim(sDtlEntryVal)) NEQ 0>
										<CFMODULE TEMPLATE="#client.common_path#cfm_leveldsn.cfm" DBLEVEL="#GetLookup.LEVELID#">
										<CFSET lk_dsn = DSN>
		
										<CFQUERY NAME="GetLkDesc" DATASOURCE="#lk_dsn#">
											SELECT #GetLookup.LOOKUPRESULTFIELD#
											<!--- For extra lookup description --->
											<CFIF Trim(GetLookup.EXTRARESULTFLD) NEQ "">
												,#GetLookup.EXTRARESULTFLD#
												<CFSET lWithExtra=true>
											</CFIF>
											FROM #GetLookup.LOOKUPTABLE#
											WHERE
												(#GetLookup.LOOKUPKEYFIELD# = '#sDtlEntryVal#')
										</CFQUERY>
		
										<CFIF GetLkDesc.RecordCount>
											[#sDtlEntryVal#] #evaluate("GetLkDesc." & GetLookup.LOOKUPRESULTFIELD)#
										<CFELSE>
											[value not found in the lookup.]
										</CFIF>
		
										<!--- for chart --->
										<!---<CFIF LCase(ISORGCHART) IS "y">
											&nbsp;&nbsp;<A HREF="javascript:ShowChart('#Trim(GetLookup.LEVELID)#','#Trim(GetLookup.LOOKUPTABLE)#','#Trim(GetLookup.LOOKUPKEYFIELD)#','#Trim(GetLookup.LOOKUPRESULTFIELD)#','#sDtlEntryVal#', '', '#COLUMNDESC#')">show chart</A>
										</CFIF>--->
									</CFIF>
								</CFIF>	<!--- getlookup.recordcount --->
							<CFELSE>
								<!--- standard edit --->
								#HTMLEditFormat(sDtlEntryVal)#
							</CFIF>
		
						</CFDEFAULTCASE>
					</CFSWITCH>
				</TD>
				</TR>
				</CFIF>
			</CFLOOP>
		</CFOUTPUT>
	</CFIF>
</CFLOOP>
</TABLE>
</body>
</html>
